<?php
$this->activemenu = 22;
$this->pageTitle=Yii::app()->name . ' - Hỏi Đáp';
$this->breadcrumbs=array(
		'Hỏi đáp'=>array('default/page', 'alias'=>'hoi-dap'),
		$askDetail->title
);
?>
<div class="detail-page">
<div class="head-tool">
	<div class="main-title">Hỏi</div>
</div>
<div class="content-box">
	<div class="thumb-avatar"><img src="<?php echo Yii::app()->theme->baseUrl;?>/images/silhouette96.png" /></div>
	<div class="aa-title"><?php echo $askDetail->title;?></div>
	<div class="aa-content"><?php echo $askDetail->content;?></div>
</div>
<div class="bt-reply"><button onclick="$('.f-reply').toggle();">Trả lời</button></div>
<?php if(Yii::app()->user->hasFlash('reply-flash')):?>
<div class="replymsg"><?php echo Yii::app()->user->getFlash('reply-flash');?></div>
<?php endif;?>
<div class="f-reply" style="display: none;">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'aa-form',
	'enableAjaxValidation' => true,
	'enableClientValidation'=>true,
	'clientOptions'=>array(
			'validateOnSubmit'=>true,
	),
	));
?>
<?php echo $form->error($answerForm,'email'); ?>
<?php echo $form->error($answerForm,'avatar'); ?>
<?php echo $form->error($answerForm,'content'); ?>

<table>
	<tr>
		<td><label>Email của bạn</label></td>
		<td>
			<?php echo $form->textField($answerForm,'email', array('size'=>50, 'maxlength'=>255)); ?>
		</td>
	</tr>
	<tr>
		<td><label>Nhập họ tên</label></td>
		<td>
			<?php echo $form->textField($answerForm,'avatar', array('size'=>50, 'maxlength'=>255)); ?>
		</td>
	</tr>
	<tr>
		<td><label>Ý kiến của bạn</label></td>
		<td>
			<?php echo $form->textArea($answerForm,'content'); ?>
		</td>
	</tr>
	<tr>
		<td><label>Mã xác thực</label></td>
		<td>
		<?php if(CCaptcha::checkRequirements()): ?>
		<div>
		<?php echo $form->textField($answerForm,'verifyCode'); ?>
		<?php $this->widget('CCaptcha'); ?>
		</div>
		<?php echo $form->error($answerForm,'verifyCode'); ?>
	<?php endif; ?>
		</td>
	</tr>
	<tr>
		<td align="center" colspan="2"><?php echo CHtml::submitButton('Gửi'); ?></td>
	</tr>	
</table>
<?php echo CHtml::hiddenField('AnswerForm[ask_id]', $ask_id);?>
<?php $this->endWidget(); ?>
</div>

<div class="head-tool">
	<div class="main-title">Đáp</div>
</div>
<div class="content-box">
	<?php if($totalAnswer>0):?>
	<?php foreach ($answerList as $key => $item):?>
	<div class="aa-items">
		<div class="thumb-avatar"><img src="<?php echo Yii::app()->theme->baseUrl;?>/images/silhouette96.png" /></div>
		<div><span class="avatar"><?php echo $item['avatar'];?></span>&nbsp;post lúc <span class="aa-time"><?php echo date('H:i d/m/Y', strtotime($item['updated_datetime']))?></span>&nbsp;</div>
		<div class="content"><?php echo $item['content'];?></div>
	</div>
	<?php endforeach;?>
	<?php endif;?>
</div>
</div>